package com.weilx959.spt.plugin.e2sp.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ExcelType {
    XLS(".xls"), XLSX(".xlsx");

    private final String suffix;

    /**
     * 按后缀获取
     *
     * @param suffix 后缀
     * @return {@link ExcelType}
     */
    public static ExcelType getBySuffix(String suffix) {
        for (ExcelType excelType : ExcelType.values()) {
            if (excelType.getSuffix().equals(suffix)) {
                return excelType;
            }
        }
        return null;
    }
}
